package io.gitee.caoxiaoyu97.log.sensitive.util;

public enum KeywordTypeEnum {

    /**
     * 真实姓名
     */
    TRUE_NAME("trueName","真实姓名"),
    /**
     * 身份证号码
     */
    ID_CARD_NO("idCardNo","身份证号码"),
    /**
     * 银行卡号
     */
    BANKCARD_NO("bankcardNo","银行卡号"),
    /**
     * 手机号码
     */
    PHONE_NO("phoneNo","手机号码"),
    
//    MAIL("mail",KeywordExpEnum.MAIL,"邮箱"),
    /**
     * 其它
     */
    OTHER("other","其它");

    private String keywordType;
    private String desc;

    KeywordTypeEnum(String keywordType,String desc) {
        this.keywordType = keywordType;
        this.desc = desc;
    }
    
    /**
     * 通过keyword类型获取对象
     */
    public static KeywordTypeEnum getMessageType(String keywordType) {
        for (KeywordTypeEnum c : KeywordTypeEnum.values()) {
            if (c.isTypeMatched(keywordType)) {
                return c;
            }
        }
        return null;
    }
    
    public boolean isTypeMatched(String keywordType) {
    	return this.getKeywordType().equals(keywordType);
    }
    
    public String getKeywordType() {
        return keywordType;
    }

    public String getDesc() {
        return desc;
    }
}

